﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=RibbonControlsLibrary"
		xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
		xmlns:system="clr-namespace:System;assembly=mscorlib">
	<Style x:Key="CollapsedRibbonToggleButton" TargetType="{x:Type ribbon:RibbonToggleButton}">
		<Setter Property="Focusable" Value="True" />
		<Setter Property="BorderBrush"
				Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type ribbon:RibbonGroup}}, Path=BorderBrush}" />
		<Setter Property="MouseOverBorderBrush" Value="Transparent" />
		<Setter Property="MouseOverBackground" Value="#40FFFFFF" />
		<Setter Property="FocusedBackground"
				Value="{Binding RelativeSource={RelativeSource Self}, Path=Ribbon.FocusedBackground}" />
		<Setter Property="FocusedBorderBrush" Value="Transparent" />
		<Setter Property="CheckedBackground" Value="Transparent" />
		<Setter Property="CheckedBorderBrush" Value="Transparent" />
		<Setter Property="ClickMode" Value="Press" />
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ribbon:RibbonToggleButton}">
					<ControlTemplate.Resources>
						<DataTemplate DataType="{x:Type system:String}">
							<ribbon:RibbonTwoLineText Text="{Binding}" Margin="2,4,2,0" TextAlignment="Center"
									VerticalAlignment="Top" LineHeight="13px" LineStackingStrategy="BlockLineHeight"
									HasTwoLines="{TemplateBinding ribbon:RibbonTwoLineText.HasTwoLines}"
									PathFill="{TemplateBinding TextElement.Foreground}"
									PathData="{TemplateBinding ribbon:RibbonTwoLineText.PathData}" />
						</DataTemplate>
					</ControlTemplate.Resources>
					<Grid x:Name="MainGrid" SnapsToDevicePixels="True" Background="Transparent">
						<Border x:Name="ButtonInnerBorder" BorderThickness="1" Margin="1" BorderBrush="#EAF1FB"
								IsHitTestVisible="False" />
						<Border x:Name="ButtonOuterBorder" BorderBrush="{TemplateBinding BorderBrush}"
								Background="{TemplateBinding Background}" BorderThickness="1" IsHitTestVisible="False" />
						<Grid Margin="2" IsHitTestVisible="False">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto" />
								<RowDefinition />
							</Grid.RowDefinitions>
							<Border Grid.Row="0" x:Name="ImageOuterBorder">
								<Border x:Name="ImageMiddleBorder" Margin="3" VerticalAlignment="Top"
										HorizontalAlignment="Center" BorderBrush="#AEBECF" BorderThickness="0"
										Width="32" Height="32">
									<Grid>
										<Border x:Name="ImageInnerBorder" BorderBrush="#FCFCFC" BorderThickness="0" />
										<Image x:Name="GroupImage" Source="{TemplateBinding LargeImageSource}"
												Width="32" Height="32" HorizontalAlignment="Center"
												VerticalAlignment="Center"
												RenderOptions.BitmapScalingMode="NearestNeighbor" />
									</Grid>
								</Border>
							</Border>
							<Border x:Name="LabelBorder" Grid.Row="1" Grid.RowSpan="2">
								<ContentPresenter ribbon:RibbonTwoLineText.HasTwoLines="True"
										ribbon:RibbonTwoLineText.PathData="M 0 0 L 2.5 3 L 5 0 Z" />
							</Border>
						</Grid>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="LargeImageSource" Value="{x:Null}">
							<Setter TargetName="GroupImage" Property="Source"
									Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SmallImageSource}" />
							<Setter TargetName="GroupImage" Property="Width" Value="16" />
							<Setter TargetName="GroupImage" Property="Height" Value="16" />
							<Setter TargetName="ImageMiddleBorder" Property="BorderThickness" Value="1" />
							<Setter TargetName="ImageInnerBorder" Property="BorderThickness" Value="1" />
							<Setter TargetName="ImageInnerBorder" Property="Background" Value="#50FFFFFF" />
						</Trigger>
						<Trigger Property="IsEnabled" Value="False">
							<Setter TargetName="GroupImage" Property="Opacity" Value="0.5" />
							<Setter TargetName="MainGrid" Property="TextElement.Foreground" Value="#FF9E9E9E" />
						</Trigger>
						<MultiDataTrigger>
							<MultiDataTrigger.Conditions>
								<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}"
										Value="True" />
							</MultiDataTrigger.Conditions>
							<Setter TargetName="ImageOuterBorder" Property="Background" Value="#20BBBBBB" />
						</MultiDataTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="NormalRibbonToggleButton" TargetType="{x:Type ribbon:RibbonToggleButton}">
		<Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor" />
		<Setter Property="Focusable" Value="True" />
		<Setter Property="BorderBrush" Value="#80808080" />
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="MouseOverBorderBrush" Value="Transparent" />
		<Setter Property="FocusedBackground"
				Value="{Binding RelativeSource={RelativeSource Self}, Path=Ribbon.FocusedBackground}" />
		<Setter Property="FocusedBorderBrush" Value="Transparent" />
		<Setter Property="CheckedBorderBrush" Value="Transparent" />
		<Setter Property="Margin" Value="0,-1,0,0" />
		<Setter Property="ClickMode" Value="Press" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ribbon:RibbonToggleButton}">
					<Border Name="OuterBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"
							Background="{TemplateBinding Background}">
						<Grid IsHitTestVisible="False">
							<Border Name="InnerBorder" Background="{TemplateBinding MouseOverBackground}"
									BorderBrush="{TemplateBinding MouseOverBorderBrush}" Opacity="0" />
							<Image Name="GroupImage" Source="{TemplateBinding SmallImageSource}" Width="16" Height="16"
									HorizontalAlignment="Center" VerticalAlignment="Center"
									RenderOptions.BitmapScalingMode="{TemplateBinding RenderOptions.BitmapScalingMode}" />
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter TargetName="GroupImage" Property="Opacity" Value="0.5" />
						</Trigger>
						<MultiDataTrigger>
							<MultiDataTrigger.Conditions>
								<Condition Binding="{Binding Path=Background, RelativeSource={RelativeSource Self}}"
										Value="Transparent" />
							</MultiDataTrigger.Conditions>
							<Setter TargetName="OuterBorder" Property="Background"
									Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Ribbon.Background}" />
						</MultiDataTrigger>
						<MultiDataTrigger>
							<MultiDataTrigger.Conditions>
								<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}"
										Value="True" />
								<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}"
										Value="False" />
							</MultiDataTrigger.Conditions>
							<Setter TargetName="InnerBorder" Property="Opacity" Value="1" />
							<Setter TargetName="OuterBorder" Property="Background" Value="Transparent" />
						</MultiDataTrigger>
						<MultiDataTrigger>
							<MultiDataTrigger.Conditions>
								<Condition
										Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsKeyboardFocused}"
										Value="True" />
								<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}"
										Value="False" />
							</MultiDataTrigger.Conditions>
							<Setter TargetName="InnerBorder" Property="Opacity" Value="1" />
							<Setter TargetName="InnerBorder" Property="Background"
									Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FocusedBackground}" />
							<Setter TargetName="InnerBorder" Property="BorderBrush"
									Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FocusedBorderBrush}" />
							<Setter TargetName="OuterBorder" Property="Background" Value="Transparent" />
						</MultiDataTrigger>
						<MultiDataTrigger>
							<MultiDataTrigger.Conditions>
								<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}"
										Value="True" />
							</MultiDataTrigger.Conditions>
							<Setter TargetName="InnerBorder" Property="Background"
									Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CheckedBackground}" />
							<Setter TargetName="InnerBorder" Property="BorderBrush"
									Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CheckedBorderBrush}" />
							<Setter TargetName="InnerBorder" Property="Opacity" Value="1" />
							<Setter TargetName="OuterBorder" Property="Background" Value="Transparent" />
							<Setter TargetName="OuterBorder" Property="BorderBrush" Value="#AA808080" />
						</MultiDataTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<ControlTemplate x:Key="NormalRibbonGroup" TargetType="{x:Type ribbon:RibbonGroup}">
		<Border Name="GroupBorder" Background="{TemplateBinding Background}" Margin="1,2,0,0">
			<Grid x:Name="MainGrid" Background="Transparent">
				<Grid.RowDefinitions>
					<RowDefinition Height="*" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" MinHeight="16" />
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="*" />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>
				<Border Name="SeparatorBorder" Background="{TemplateBinding BorderBrush}" Grid.Column="1"
						Grid.RowSpan="3" Height="75" Width="1" VerticalAlignment="Center" SnapsToDevicePixels="True"
						IsHitTestVisible="False" />
				<Grid Margin="5,1,5,0">
					<ItemsPresenter Name="ItemsPresenter" HorizontalAlignment="Center" />
					<ContentControl Name="TemplateContentControl" Visibility="Collapsed" Focusable="False" />
				</Grid>
				<Border Name="LabelSeparatorBorder" Grid.Row="1" Height="1" Margin="5,1,5,-1" IsHitTestVisible="False" />
				<Grid Margin="2,0" Grid.Row="2" IsHitTestVisible="False">
					<ContentPresenter Name="PART_Header" TextElement.Foreground="#FF666666" TextElement.FontSize="11"
							ContentSource="Header" Margin="2,0" MaxHeight="16" HorizontalAlignment="Center"
							VerticalAlignment="Center" />
				</Grid>
			</Grid>
		</Border>
		<ControlTemplate.Triggers>
			<Trigger Property="IsEnabled" Value="False">
				<Setter TargetName="MainGrid" Property="TextElement.Foreground" Value="#FF9E9E9E" />
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
	<ControlTemplate x:Key="CollapsedRibbonGroup" TargetType="{x:Type ribbon:RibbonGroup}">
		<Grid x:Name="MainGrid" Background="Transparent">
			<ribbon:RibbonToggleButton x:Name="PART_ToggleButton" Margin="0,3,0,0"
					Style="{StaticResource CollapsedRibbonToggleButton}" Content="{TemplateBinding Header}"
					ContentTemplate="{TemplateBinding HeaderTemplate}"
					ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
					ContentStringFormat="{TemplateBinding HeaderStringFormat}" Background="{TemplateBinding Background}"
					LargeImageSource="{TemplateBinding LargeImageSource}"
					SmallImageSource="{TemplateBinding SmallImageSource}"
					IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
			<Popup x:Name="PART_Popup" AllowsTransparency="true" Placement="Bottom"
					PlacementTarget="{Binding ElementName=PART_ToggleButton}"
					IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
					Focusable="false"
					PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
				<Grid Name="PopupGrid" Height="{TemplateBinding ActualHeight}" Margin="0,1.5,0,0">
					<Grid.RowDefinitions>
						<RowDefinition Height="*" />
						<RowDefinition Height="Auto" MinHeight="16" />
					</Grid.RowDefinitions>
					<Border Name="PopupBorder" Grid.RowSpan="2" Background="{TemplateBinding Background}"
							BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Ribbon.BorderBrush}"
							BorderThickness="1" IsHitTestVisible="False" />
					<Border Name="PART_HotBackground" Background="{TemplateBinding MouseOverBackground}"
							BorderBrush="{TemplateBinding MouseOverBorderBrush}" Opacity="0" Grid.RowSpan="2"
							BorderThickness="1" SnapsToDevicePixels="True" IsHitTestVisible="False" />
					<Border Margin="2,3.5,2,0" Padding="3,0,3,0" x:Name="PART_RibbonControlsHostBorder">
						<Grid>
							<ItemsPresenter Name="ItemsPresenter" KeyboardNavigation.TabNavigation="Cycle"
									HorizontalAlignment="Center" KeyboardNavigation.DirectionalNavigation="Cycle"
									SnapsToDevicePixels="True" Grid.IsSharedSizeScope="true" />
							<ContentControl Name="TemplateContentControl" Visibility="Collapsed" Focusable="False" />
						</Grid>
					</Border>
					<Grid Margin="2,0,2,1" Grid.Row="1" IsHitTestVisible="False">
						<ContentPresenter Name="PART_Header" TextElement.Foreground="#FF666666"
								TextElement.FontSize="11" ContentSource="Header" Margin="2,0,2,0" MaxHeight="15"
								HorizontalAlignment="Center" VerticalAlignment="Center" />
					</Grid>
				</Grid>
			</Popup>
		</Grid>
		<ControlTemplate.Triggers>
			<MultiDataTrigger>
				<MultiDataTrigger.Conditions>
					<Condition Binding="{Binding Path=Background, RelativeSource={RelativeSource Self}}"
							Value="Transparent" />
				</MultiDataTrigger.Conditions>
				<Setter TargetName="PopupBorder" Property="Background"
						Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Ribbon.Background}" />
			</MultiDataTrigger>
			<Trigger Property="IsEnabled" Value="False">
				<Setter TargetName="MainGrid" Property="TextElement.Foreground" Value="#FF9E9E9E" />
			</Trigger>
			<Trigger SourceName="PART_Popup" Property="Popup.IsOpen" Value="False">
				<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
			</Trigger>
			<Trigger Property="IsInQuickAccessToolBar" Value="True">
				<Setter TargetName="PopupGrid" Property="Height" Value="91.0" />
				<Setter TargetName="PART_ToggleButton" Property="Style"
						Value="{StaticResource NormalRibbonToggleButton}" />
				<Setter TargetName="PART_ToggleButton" Property="Margin" Value="0" />
			</Trigger>
			<Trigger Property="IsDropDownOpen" Value="True">
				<Setter TargetName="MainGrid" Property="ToolTipService.IsEnabled" Value="False" />
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
	<Style TargetType="{x:Type ribbon:RibbonGroup}">
		<Setter Property="Margin" Value="1" />
		<Setter Property="Padding" Value="3,0,3,0" />
		<Setter Property="FocusVisualStyle" Value="{x:Null}" />
		<Setter Property="Template" Value="{StaticResource NormalRibbonGroup}" />
		<Setter Property="Background" Value="{DynamicResource White}" />
		<Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=Ribbon.BorderBrush}" />
		<Setter Property="MouseOverBackground" Value="{DynamicResource White}" />
		<Setter Property="MouseOverBorderBrush" Value="Transparent" />
		<Setter Property="ToolTipService.InitialShowDelay" Value="900" />
		<Setter Property="ToolTipService.ShowDuration" Value="20000" />
		<Setter Property="ToolTipService.BetweenShowDelay" Value="0" />
		<Style.Triggers>
			<Trigger Property="IsCollapsed" Value="True">
				<Setter Property="Template" Value="{StaticResource CollapsedRibbonGroup}" />
			</Trigger>
		</Style.Triggers>
	</Style>
</ResourceDictionary>